<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="btn" onclick="console.log('hi');">button</button>
    <script>
        /*
            1. on<click>-事件前缀<事件名>
            2. onClick=""  onclick="" 特性不区分大小写，btn.onclick btn.onClick 属性区分大小写
            3. 设置btn.onclick=null 清除事件处理函数
        */
        const btn = document.getElementById('btn');
        btn.onclick = function () {
            console.log('hello');
        }

        setTimeout(() => {
            btn.removeAttribute('onclick');
            console.log(btn.onclick);
        }, 3000);


    </script>
</body>

</html>